package com.itheima.开启多线程.mycallable;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @Author 王加鑫
 * @Date 2021/5/22 10:40
 * @Version 1.0
 */
public class Demo03 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {

        for (int i = 0; i < 100; i++) {
            System.out.println("main" + i);
        }

        MyCallable callable = new MyCallable();
        FutureTask<String> futureTask = new FutureTask(callable);
        Thread thread = new Thread(futureTask);
        thread.start();
        String s = futureTask.get();
        System.out.println(s);



    }
}
